package it.espsoft.easysuperenalotto.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DataBaseCreationHelper extends SQLiteOpenHelper implements TableNames {
	public static final String DATABASE_NAME = "SuperEnalotto";
	public static final int DATABASE_VERSION = 1;
	
    private static final String GIOCATE_TABLE_CREATE =
                "CREATE TABLE " + GIOCATE_TABLE_NAME + " (" +
                	"id INTEGER PRIMARY KEY AUTOINCREMENT,"+
	                "primo TEXT," +
	                "secondo TEXT,"+
	                "terzo TEXT,"+
	                "quarto TEXT,"+
	                "quinto TEXT,"+
	                "sesto TEXT,"+
	                "superstar TEXT);";
    
    private static final String ESTRAZIONI_TABLE_CREATE =
        "CREATE TABLE " + ESTRAZIONI_TABLE_NAME + " (" +
        "id INTEGER PRIMARY KEY AUTOINCREMENT,"+
        "concorso TEXT,"+
        "numConcorso INTEGER,"+
        "dataConcorso DATE,"+
        "jackpot TEXT,"+
        "combinazione TEXT,"+
        "primo TEXT,"+
        "secondo TEXT,"+
        "terzo TEXT,"+
        "quarto TEXT,"+
        "quinto TEXT,"+
        "sesto TEXT,"+
        "superstar TEXT,"+
        "jolly TEXT);";
    
    private String[] tables = {GIOCATE_TABLE_CREATE, ESTRAZIONI_TABLE_CREATE};
   
    DataBaseCreationHelper(Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
        
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
    	for (String table : tables) {
    		db.execSQL(table);
		}
    }

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO Auto-generated method stub
	}
}
